<?php 
$maxRows_rs_contactus = 25;
$pageNum_rs_contactus = 0;
if (isset($_GET['pageNum_rs_contactus'])) {
  $pageNum_rs_contactus = $_GET['pageNum_rs_contactus'];
}
$startRow_rs_contactus = $pageNum_rs_contactus * $maxRows_rs_contactus;
$rs_contactus = getContactList( $startRow_rs_contactus, $maxRows_rs_contactus,$NO);
$row_rs_contactus = mysql_fetch_assoc($rs_contactus);

if (isset($_GET['totalRows_rs_contactus'])) {
  $totalRows_rs_contactus = $_GET['totalRows_rs_contactus'];
} else {

  $totalRows_rs_contactus = getContactList( $startRow_rs_contactus, $maxRows_rs_contactus,$YES);
}
$totalPages_rs_contactus = ceil($totalRows_rs_contactus/$maxRows_rs_contactus)-1;
 ?>
<form id="viewcontact" name="viewcontact" method="post" action="">
  <input type="submit" name="button" id="button" value="Delete" onclick="document.getElementById('frmaction').value='delete'" />
  <label>
    <input type="hidden" name="frmaction" id="frmaction" />
    <input type="hidden" name="viewcontactfrm" id="viewcontactfrm" />
  </label>
  <table width="102%" border="0" cellpadding="0" cellspacing="0" id="datatable">
    <tr>
      <th height="27">Contact id</th>
      <th>Name</th>
      <th>Email</th>
      <th>Topic</th>
      <th>Date</th>
      <td><input type="checkbox" name="delchk_0" id="delchk_0" onchange="chechUncheck('viewcontact','delchk')" /></td>
    </tr>
    <?php
  $cnt=0;
  do {  $cnt++;?>
    <tr>
      <td><?php echo $row_rs_contactus['contact_message_id']; ?></td>
      <td><a href="./?page=<?php echo $page; ?>&amp;itemid=<?php echo $row_rs_contactus['contact_message_id']; ?>"><?php echo $row_rs_contactus['sender_name']; ?></a></td>
      <td><?php echo $row_rs_contactus['sender_email']; ?></td>
      <td><?php echo $row_rs_contactus['topic']; ?></td>
      <td><?php echo $row_rs_contactus['date_posted']; ?></td>
      <td><label>
        <input type="checkbox" name="delchk_<?php echo  $cnt;?>" id="delchk_<?php echo  $cnt;?>"  value="<?php echo $row_rs_contactus['contact_message_id']; ?>"/>
      </label></td>
    </tr>
    <?php } while ($row_rs_contactus = mysql_fetch_assoc($rs_contactus)); ?>
  </table>
  <?php

mysql_free_result($rs_contactus);
?>
</form>
